/**
 * 主要程序框架
 * <p>规定客户端样式、以及包含的内容<br>
 * <p>包含内容：mainApplet()函数<br>
 * <p>openOtherPicc()函数<br>
 * <p>buttonOtherPicc()函数;<br>
 * <p>otherPicc()函数<br>
 * <p>init()函数<br>
 * <p>actionPerformed()函数<br>
 * <p>closeFrames()函数<br>
 * <p>start()函数<br>
 * @author 吴杨君
 * @author 孔令炜
 * @version 1.0*/
import java.awt.*;
import java.lang.*;
import java.awt.event.*;
import javax.swing.text.*;
import javax.swing.*;
import java.applet.Applet;
import javax.swing.JApplet;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;

@SuppressWarnings( { "serial", "unused" })
public class mainApplet extends JApplet implements ActionListener {
	public mainApplet() {
	}

	// Variables:控制窗体开关的标志量
	boolean openOtherPicc = false;

	// GUI Variables
	private JButton buttonOtherPicc;

	static FrameOtherPicc otherPicc;

	public void init() {
		setSize(450, 360);// 设置

		buttonOtherPicc = new JButton();
		buttonOtherPicc.setFont(new Font("Microsoft YaHei", Font.PLAIN, 10));
		buttonOtherPicc.setBounds(122, 151, 176, 23);
		// 验证信息按钮
		buttonOtherPicc.setText("验证信息");
		// 电子票PC端添加标题
		JLabel lblMifareCardProgramming = new JLabel("电子票PC端");
		lblMifareCardProgramming.setFont(new Font("Microsoft YaHei",
				Font.PLAIN, 10));
		lblMifareCardProgramming.setBounds(185, 126, 143, 14);

		getContentPane().setLayout(null);
		getContentPane().add(lblMifareCardProgramming);
		getContentPane().add(buttonOtherPicc);

		buttonOtherPicc.addActionListener(this);

	}

	public void actionPerformed(ActionEvent e) {
		if (buttonOtherPicc == e.getSource()) {
			closeFrames();
			if (openOtherPicc == false) {
				// FrameOtherPicc进程打开
				otherPicc = new FrameOtherPicc();
				otherPicc.setVisible(true);
				openOtherPicc = true;
			} else {
				// FrameOtherPicc进程打开
				otherPicc.dispose();
				otherPicc = new FrameOtherPicc();
				otherPicc.setVisible(true);
				openOtherPicc = true;
			}
		}
	}

	public void closeFrames() {
		if (openOtherPicc == true) {
			// otherPicc关闭
			otherPicc.dispose();
			openOtherPicc = false;
		}
	}

	public void start() {

	}
}